(* Mathematica package *)
Options[InternalTransferC] = {InternalTransferCoefficientMethod -> "SII"}
(*Incidence medium 0 to interface v*)
InternalTransferC["0-","v-'", SIv_, PhaseMv_, SIIv_, 
	InternalTransferCoefficientMethod -> "PartialSystemTransferCoefficients"] := tTOP[SIv]/denomv[SIv, PhaseMv, SIIv];
InternalTransferC["0-","v+'", SIv_, PhaseMv_, SIIv_,
	InternalTransferCoefficientMethod -> "PartialSystemTransferCoefficients"] := (tTOP[SIv] rTOP[SIIv] (PhaseMv[[1, 1]])^(-2))/ denomv[SIv, PhaseMv, SIIv];
InternalTransferC["0-","v-", SIvm1_, Phivm1_, SIIvm1_,
	InternalTransferCoefficientMethod -> "PartialSystemTransferCoefficients"] := (tTOP[SIvm1] Phivm1[[2, 2]])/ denomv[SIvm1, Phivm1, SIIvm1];
InternalTransferC["0-","v+", SIvm1_, Phivm1_, SIIvm1_,
	InternalTransferCoefficientMethod -> "PartialSystemTransferCoefficients"] := (tTOP[SIvm1] rTOP[SIIvm1] Phivm1[[2, 2]])/ denomv[SIvm1, Phivm1, SIIvm1];

(*Incidence medium k+1 to interface v *)
InternalTransferC["kp1+'","v-'", SIv_, PhaseMv_, SIIv_,
	InternalTransferCoefficientMethod -> "PartialSystemTransferCoefficients"] := (tBOT[SIIv] rBOT[SIv] (PhaseMv[[1, 1]])^(-1))/ denomv[SIv, PhaseMv, SIIv];
InternalTransferC["kp1+'","v+'", SIv_, PhaseMv_, SIIv_,
	InternalTransferCoefficientMethod -> "PartialSystemTransferCoefficients"] := (tBOT[SIIv] (PhaseMv[[1, 1]])^(-1))/ denomv[SIv, PhaseMv, SIIv];
InternalTransferC["kp1+'","v-", SIvm1_, Phivm1_, SIIvm1_,
	InternalTransferCoefficientMethod -> "PartialSystemTransferCoefficients"] := (tBOT[SIIvm1] rBOT[SIvm1] (Phivm1[[1, 1]])^(-2))/ denomv[SIvm1, Phivm1, SIIvm1];
InternalTransferC["kp1+'","v+", SIvm1_, Phivm1_, SIIvm1_,
	InternalTransferCoefficientMethod -> "PartialSystemTransferCoefficients"] := tBOT[SIIvm1]/ denomv[SIvm1, Phivm1, SIIvm1]


(*Internal Transfer Coefficients, calculate from Subsystem II*)

(*Incidence from medium 0 (First)*)
InternalTransferC["0-", "v-'", SIv_, PhaseMv_, SIIv_, InternalTransferCoefficientMethod -> "SII"] := Block[{PhiSIIv=PhaseMv.SIIv},tTOP[(*S*)SIv.PhiSIIv] (PhiSIIv)[[1, 1]]];
InternalTransferC["0-", "v+'", SIv_, PhaseMv_, SIIv_, InternalTransferCoefficientMethod -> "SII"] := Block[{PhiSIIv=PhaseMv.SIIv},tTOP[(*S*)SIv.PhiSIIv] (PhiSIIv)[[2, 1]]];
InternalTransferC["0-", "v-", SIvm1_, Phivm1_, SIIvm1_, InternalTransferCoefficientMethod -> "SII"] := tTOP[(*S*)SIvm1.Phivm1.SIIvm1] SIIvm1[[1, 1]];
InternalTransferC["0-", "v+", SIvm1_, Phivm1_, SIIvm1_, InternalTransferCoefficientMethod -> "SII"] := tTOP[(*S*)SIvm1.Phivm1.SIIvm1] SIIvm1[[2, 1]];

InternalTransferC["0-", "v-'", SIv_, PhaseMv_, SIIv_] := Block[{PhiSIIv=PhaseMv.SIIv},tTOP[(*S*)SIv.PhiSIIv] (PhiSIIv)[[1, 1]]];
InternalTransferC["0-", "v+'", SIv_, PhaseMv_, SIIv_] := Block[{PhiSIIv=PhaseMv.SIIv},tTOP[(*S*)SIv.PhiSIIv] (PhiSIIv)[[2, 1]]];
InternalTransferC["0-", "v-", SIvm1_, Phivm1_, SIIvm1_] := tTOP[(*S*)SIvm1.Phivm1.SIIvm1] SIIvm1[[1, 1]];
InternalTransferC["0-", "v+", SIvm1_, Phivm1_, SIIvm1_] := tTOP[(*S*)SIvm1.Phivm1.SIIvm1] SIIvm1[[2, 1]];

(*Incidence from medium k+1 (Last)*)
InternalTransferC["kp1+'", "v-'", SIv_, PhaseMv_, SIIv_, InternalTransferCoefficientMethod -> "SII"] := Block[{PhiSIIv=PhaseMv.SIIv},(PhiSIIv.{rBOT[(*S*)SIv.PhiSIIv], 1})[[1]]];
InternalTransferC["kp1+'", "v+'", SIv_, PhaseMv_, SIIv_, InternalTransferCoefficientMethod -> "SII"] := Block[{PhiSIIv=PhaseMv.SIIv},(PhiSIIv.{rBOT[(*S*)SIv.PhiSIIv], 1})[[2]]];
InternalTransferC[ "kp1+'", "v-", SIvm1_, Phivm1_, SIIvm1_, InternalTransferCoefficientMethod -> "SII"] := (SIIvm1.{rBOT[(*S*)SIvm1.Phivm1.SIIvm1], 1})[[1]];
InternalTransferC[ "kp1+'", "v+", SIvm1_, Phivm1_, SIIvm1_, InternalTransferCoefficientMethod -> "SII"] := (SIIvm1.{rBOT[(*S*)SIvm1.Phivm1.SIIvm1], 1})[[2]];

InternalTransferC["kp1+'", "v-'", SIv_, PhaseMv_, SIIv_] := Block[{PhiSIIv=PhaseMv.SIIv},(PhiSIIv.{rBOT[(*S*)SIv.PhiSIIv], 1})[[1]]];
InternalTransferC["kp1+'", "v+'", SIv_, PhaseMv_, SIIv_] := Block[{PhiSIIv=PhaseMv.SIIv},(PhiSIIv.{rBOT[(*S*)SIv.PhiSIIv], 1})[[2]]];
InternalTransferC[ "kp1+'", "v-", SIvm1_, Phivm1_, SIIvm1_] := (SIIvm1.{rBOT[(*S*)SIvm1.Phivm1.SIIvm1], 1})[[1]];
InternalTransferC[ "kp1+'", "v+", SIvm1_, Phivm1_, SIIvm1_] := (SIIvm1.{rBOT[(*S*)SIvm1.Phivm1.SIIvm1], 1})[[2]];

(*Paired Evaluation for Increased Execution Speed of InputTransferC*)
InternalTransferC["0-","vBottomSide",SIv_, PhaseMv_, SIIv_] := Block[{PhiSIIv=PhaseMv.SIIv},PhiSIIv .{tTOP[(*S*)SIv.PhiSIIv],0}](*[[All,1]]*);
InternalTransferC["0-","vTopSide",SIvm1_,Phivm1_,SIIvm1_] := SIIvm1 . {tTOP[(*S*)SIvm1.Phivm1.SIIvm1],0};
InternalTransferC["kp1+'","vBottomSide",SIv_, PhaseMv_, SIIv_] := Block[{PhiSIIv=PhaseMv.SIIv},(PhiSIIv.{rBOT[(*S*)SIv.PhiSIIv], 1})];
InternalTransferC["kp1+'","vTopSide", SIvm1_, Phivm1_, SIIvm1_] := SIIvm1.{rBOT[(*S*)SIvm1.Phivm1.SIIvm1], 1};

InternalTransferC[args___] := "unevaluated"/;Message[General::badargs, InternalTransferC]
